package com.dahua.strategy.version1;

/**
 * 现金收费工厂类
 * @author sunhongguang
 * @create 2022-01-10-23:42
 */
public class CashFactory {

    /**
     * 通过传入的活动类型，返回指定活动类型的实例对象
     * @param type  活动类型
     * @return      指定活动类型的实例对象
     */
    public static CashSuper crateCashAccept(String type){
        CashSuper cashSuper = null;
        switch (type){
            case "正常收费":
                cashSuper = new CashNormal();
                break;
            case "满300返100":
                cashSuper = new CashReturn(300, 100);
                break;
            case "打8折":
                cashSuper = new CashRebate(0.8);
                break;
        }
        return cashSuper;
    }
}
